package com.geek.water.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author yangwenqi
 * @decs 消息规则配置表
 * @date 2025/1/2
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("message_rule")
@ApiModel(description = "消息规则配置表")
public class MessageRule implements Serializable {
    @ApiModelProperty("主键，自增规则ID")
    @TableId(type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("规则名称")
    @TableField("rule_name")
    private String ruleName;

    @ApiModelProperty("规则类型：BILL_OVERDUE-催缴提醒, DEVICE_OFFLINE-设备离线, WORKORDER_OVERDUE-工单超期, SYSTEM_ALERT-系统告警")
    @TableField("rule_type")
    private String ruleType;

    @ApiModelProperty("触发条件，JSON格式配置")
    @TableField("trigger_condition")
    private String triggerCondition;

    @ApiModelProperty("消息模板ID")
    @TableField("template_id")
    private Long templateId;

    @ApiModelProperty("发送渠道：EMAIL-邮件, SMS-短信, APP-应用推送")
    @TableField("channels")
    private String channels;

    @ApiModelProperty("接收者类型：USER-用户, CUSTOMER-客户, ROLE-角色, ALL-全部")
    @TableField("recipient_type")
    private String recipientType;

    @ApiModelProperty("接收者配置，JSON格式")
    @TableField("recipient_config")
    private String recipientConfig;

    @ApiModelProperty("消息等级：LOW-低, MEDIUM-中, HIGH-高, URGENT-紧急")
    @TableField("level")
    private String level;

    @ApiModelProperty("是否启用：0-禁用, 1-启用")
    @TableField("enabled")
    private Integer enabled;

    @ApiModelProperty("重试次数")
    @TableField("retry_count")
    private Integer retryCount;

    @ApiModelProperty("重试间隔（分钟）")
    @TableField("retry_interval")
    private Integer retryInterval;

    @ApiModelProperty("创建时间")
    @TableField("created_at")
    private LocalDateTime createdAt;

    @ApiModelProperty("更新时间")
    @TableField("updated_at")
    private LocalDateTime updatedAt;

    @ApiModelProperty("创建人ID")
    @TableField("created_by")
    private Long createdBy;

    @ApiModelProperty("备注")
    @TableField("remark")
    private String remark;
}
